<?
if(!empty($fee_data))
{
	foreach($fee_data as $fd)
	{
		$fee_name_val = set_value('fee_name') == FALSE ?  $fd->fee_name : set_value('fee_name');
		$fee_rate_val = set_value('fee_rate') == FALSE ?  $fd->fee_rate: set_value('fee_rate');
		$fee_desc_val = set_value('fee_desc') == FALSE ? $fd->fee_desc :  set_value('fee_desc');
		$fee_stat_val = set_select('fee_stat') == FALSE ? $fd->fee_stat : set_select('fee_stat');
		$fee_id = $fd->fee_id;
		$fee_new = $fd->fee_new;
		$fee_old = $fd->fee_old;
		$is_tuition_fee = $fd->is_tuition_fee;
		$is_cca_fee = $fd->is_cca_fee;
		$is_misc_fee = $fd->is_misc_fee;
		$is_other_fee = $fd->is_other_fee;
		$is_assess_fee = $fd->is_assess_fee;
		$grade_level = $fd->grade_level;
		$fee_order = $fd->fee_order;
		
	}	
		$hd_att = array('fee_id'=>$fee_id);
		$fn_att = array('name'=>'fee_name','value'=>$fee_name_val);
		$fd_att = array('name'=>'fee_desc','value'=>$fee_desc_val);
		$fr_att = array('name'=>'fee_rate','value'=>$fee_rate_val);
		$fo_att = array('name'=>'fee_order','value'=>$fee_order);
		$frm_att = array('class'=>'custom');
		$fs_options = array(''=>'select status','active'=>'Active','inactive'=>'Inactive');
}
		
		// echo '<pre>';
		// print_r($fee_data);
		// echo '</pre>';
 ?>
 
	<div class="form">
	<div class="panel callout">
		<h6>Update Fees</h6>
	</div>
	<?if(isset($system_message))echo $system_message;
	echo validation_errors('<div class="error">', '</div>');
	?>
			<?echo form_open('student_fees/update_fees/',$frm_att);?>
		<div class="input-block">
			<?
				echo form_label('Fee Name');
				echo form_input($fn_att);
			?>
		</div>
		<div class="input-block">
			<?
				echo form_label('Fee Rate');
				echo form_input($fr_att);
			?>
		</div>
		<div class="input-block">
			<?
				echo form_label('Fee Description');
				echo form_textarea($fd_att);
			?>
		</div>
		<div class="input-block">
			<?
				echo form_label('Display Order');
				echo form_input($fo_att);
			?>
		</div>
		<div class="input-block">
			  <? echo form_label('For'); ?>
			  <?php if($fee_new == 'yes'){ echo'<input type="checkbox" name="fee_new" value="yes" checked>'; }else{ echo'<input type="checkbox" name="fee_new" value="yes" >'; } ?>&nbsp;&nbsp;New Enrollee
			  <br />
			  <?php if($fee_old == 'yes'){ echo'<input type="checkbox" name="fee_old" value="yes" checked>'; }else{ echo'<input type="checkbox" name="fee_old" value="yes" >'; } ?>&nbsp;&nbsp;Old Enrollee
			  <br />
		</div>
		
		<div>

			 	<label>Type Of Fee:</label>


			 	<select name="fee_type" id="fee" url="<?=site_url('output/get_gradelevel_data_two/'.$auth.'/'.$grade_level)?>">
				<option value=""></option>
				<option value="is_tuition_fee" <?php echo $is_tuition_fee == 1 ? "selected":""; ?>>Tuition Fee</option>
				<option value="is_cca_fee" <?php echo $is_cca_fee == 1 ? "selected":""; ?>>Matriculation</option>
				<option value="is_misc_fee" <?php echo $is_misc_fee == 1 ? "selected":""; ?>>Other School Fee</option>
				<option value="is_other_fee">Miscellaneous Fee</option>
				<option value="is_assess_fee" <?php echo $is_assess_fee == 1 ? "selected":""; ?>>Assessment Fee</option>
			</select>

		</div>
		
		<div class="row dynamic-dropdown"></div>
		
		
		<div class="input-block">
			<?
				echo form_label('Fee Status');
				echo form_dropdown('fee_stat',$fs_options,$fee_stat_val);
			?>
		</div>
		
		<div class="input-block">
			<?
				echo form_hidden($hd_att);
				echo form_submit('update_fees','Update Fees','class="btn btn-primary"');
				echo form_close();
			?>
			<a href="<?php echo site_url('student_fees/fees'); ?>" class="btn btn-default">Back</a>
		</div>
		
	</div>
	<div class="clearfloat"></div>
</div>
<div>&nbsp;</div>
</div>

<script>
		$(document).ready(function() { 
		var url = $('#fee').attr('url');		
	<?php
	if($is_tuition_fee == 1 || $is_cca_fee == 1 || $is_misc_fee == 1)
		{
	?>
		
			$.get(url, function(data) {
			  $('.dynamic-dropdown').html(data).show(50);
			});
	<?php
		}else{
	?>
			$('.dynamic-dropdown').hide(50);
	<?php
		}
	?>
		});// --- end document ready ---
</script>